/**
 * Copyright (C), 2015-2020, XXX有限公司
 * FileName: BusCollectFragmentAdapter
 * Author: Clark
 * Date: 2020/10/10 21:33
 * Description:
 * History:
 * <author> <time> <version> <desc>
 * 作者姓名 修改时间 版本号 描述
 */
package sz.szsmk.citizencard.ui.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.List;

/**
 * @ClassName: BusCollectFragmentAdapter
 * @Description:
 * @Author: Clark
 * @Date: 2020/10/10 21:33
 */
public class BusCollectFragmentAdapter extends FragmentStateAdapter {
    private List<Fragment> mFragments;

    public BusCollectFragmentAdapter(@NonNull FragmentActivity fragmentActivity,List<Fragment> fragments) {
        super(fragmentActivity);
        this.mFragments=fragments;
    }

    public BusCollectFragmentAdapter(@NonNull Fragment fragment) {
        super(fragment);
    }

    public BusCollectFragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
        super(fragmentManager, lifecycle);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getItemCount() {
        return mFragments.size();
    }
}